import request from "@/utils/request.js";
import { setting } from "@/config/setting";

const { tokenName } = setting;
const baseUrl = "/game/role";
export const getRolesByIdApi = async (userId) => {
  return request({
    url: `${baseUrl}/getRoles/${userId}`,
    method: "get",
  });
};

export const addSingleRoleApi = async (role) => {
  return request({
    url: `${baseUrl}/addRoles`,
    method: "post",
    data:role
  });
};

export const addRoleListApi = async (roleList) => {
  console.log('roleList:',roleList)
  return request({
    url: `${baseUrl}/addRolesList`,
    method: "post",
    data:roleList
  });
};

export const removeRoleListApi = async (roleList) => {
  return request({
    url: `${baseUrl}/deleteRoleList`,
    method: "post",
    data: roleList
  });
};

export const updateSingleRoleApi = async (role) => {
  return request({
    url: `${baseUrl}/updateRoles`,
    method: "put",
    data:role
  });
};

export const updateRoleListApi = async (roleList) => {
  return request({
    url: `${baseUrl}/updateRoleList`,
    method: "put",
    data:roleList
  });
};
